package cn.kk.communication.service.impl;

import cn.kk.communication.dao.impl.CommunicationDao;
import cn.kk.communication.entity.Communication;
import cn.kk.communication.service.CommunicationService;

import java.sql.SQLException;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author kk
 * @since 2022-11-19
 */
public class CommunicationServiceImpl implements CommunicationService {
    CommunicationDao communicationDao = new CommunicationDao();
    /**
     * 用户登录
     *
     * @param username
     * @param
     * @return
     */
    @Override
    public Communication getByName(String username) throws SQLException {
        Communication communication = communicationDao.getByName(username);
        return communication;
    }

    @Override
    public List<Communication> getAll() throws SQLException {
        return communicationDao.getAll();
    }

    /**
     * 注册
     *
     * @param addCommunication
     * @return
     */
    @Override
    public int addUser(Communication addCommunication) throws SQLException {
        return communicationDao.addCommunication(addCommunication);
    }
}
